package com.fdb.efp.nls.api.rest;


import java.text.SimpleDateFormat;
import java.util.List;

import com.fdb.basic.framework.core.constant.ResponseData;
import com.fdb.basic.framework.web.controller.AbstractController;
import com.fdb.basic.sequence.service.facade.SequenceService;
import com.fdb.efp.nls.service.facade.psd.PsdTaskReqInfoService;
import com.fdb.efp.nls.service.vo.psd.PsdTaskReqInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/api")
public class PsdTaskReqInfoController extends AbstractController {

	@Autowired
	@Qualifier("psdTaskReqInfoService")
	private PsdTaskReqInfoService psdTaskReqInfoService;
//	@Autowired
//	@Qualifier("sRoleDataRuleService")
//	private SRoleDataRuleService sRoleDataRuleService;

	@Autowired
	@Qualifier("dbSeqService")
	private SequenceService sequenceService;

		/**
	 * 列表数据查询
	 *
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value = "/psd/task/req/infos", method = RequestMethod.POST)
	public @ResponseBody
	ResponseData<List<PsdTaskReqInfoVO>> queryPsdTaskReqInfoAll(
			@RequestBody PsdTaskReqInfoVO vo) {
		List<PsdTaskReqInfoVO> outputVo = psdTaskReqInfoService.queryAllOwner(vo);
//		Map<String,String> dataRuleTypeMap = sRoleDataRuleService.getDataRuleType(httpRequest.getRequestURI(), getUserRoles());
//		vo.setPrdCodebyBaseInfo(dataRuleTypeMap == null ? null:dataRuleTypeMap.get(PubConstant.PRD_CODE));
//		DataRuleType dataRuleType = DataRuleType.getDataRuleType(dataRuleTypeMap == null ? null:dataRuleTypeMap.get(PubConstant.PERMIS_TYPE));
//		setUserInfoToVO(vo);
//		// 根据权限方案调用不同的方案进行数据查询
//		switch (dataRuleType) {
//			case Owner:
//				outputVo = psdTaskReqInfoService.queryAllOwner(vo);
//				break;
//			case CurrOrg:
//				outputVo = psdTaskReqInfoService.queryAllCurrOrg(vo);
//				break;
//			case CurrDownOrg:
//				outputVo = psdTaskReqInfoService.queryAllCurrDownOrg(vo);
//				break;
////			case CurrOwnerPrd:
////				outputVo = psdTaskReqInfoService.queryAllCurrOwnerPrd(vo);
////				break;
//			default:
//				outputVo = psdTaskReqInfoService.queryAllCurrOrg(vo);
//				break;
//		}
		for (PsdTaskReqInfoVO item : outputVo){
			String sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(item.getLastUpdateTime());
			item.setLastTimeShow(sdf);
		}
		return getResponseData(outputVo);

	}

}
